package com.yanqu.road.entity.activity.hanghai;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.entity.DataStatus;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@FieldTypeAnnotation(tableName = "t_u_activity_hanghai_user_data")
public class HangHaiUserData extends DataObject {

    @FieldTypeAnnotation(desc = "活动ID", select = true, update = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "活动ID", update = true)
    private long userId;
    @FieldTypeAnnotation(desc = "资金")
    private BigDecimal money = BigDecimal.ZERO;
    @FieldTypeAnnotation(desc = "货物列表")
    private Map<Integer, HangHaiGoods> goodsMap = new ConcurrentHashMap<>();
    @FieldTypeAnnotation(desc = "港口ID")
    private int portId;
    @FieldTypeAnnotation(desc = "目标港口ID")
    private int toPortId;
    @FieldTypeAnnotation(desc = "到达时间")
    private long finishTime;
    @FieldTypeAnnotation(desc = "船等级")
    private int shipLevel;
    @FieldTypeAnnotation(desc = "上报奖励领取对应次数")
    private List<Integer> reportRewardList = new ArrayList<>();
    @FieldTypeAnnotation(desc = "上次重置时间")
    private long lastResetTime;

    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }
    }

    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setOp(DataStatus.Update);
        }
    }

    public void setPortId(int portId) {
        if (this.portId != portId) {
            this.portId = portId;
            setOp(DataStatus.Update);
        }
    }

    public void setToPortId(int toPortId) {
        if (this.toPortId != toPortId) {
            this.toPortId = toPortId;
            setOp(DataStatus.Update);
        }
    }

    public void setFinishTime(long finishTime) {
        if (this.finishTime != finishTime) {
            this.finishTime = finishTime;
            setOp(DataStatus.Update);
        }
    }

    public void setShipLevel(int shipLevel) {
        if (this.shipLevel != shipLevel) {
            this.shipLevel = shipLevel;
            setOp(DataStatus.Update);
        }
    }

    public void setMoney(BigDecimal money) {
        if (this.money.compareTo(money) != 0) {
            this.money = money;
            setOp(DataStatus.Update);
        }
    }

    public void setGoodsMap(Map<Integer, HangHaiGoods> goodsMap) {
        this.goodsMap = goodsMap;
        setUpdateOption();
    }

    public void setReportRewardList(List<Integer> reportRewardList) {
        this.reportRewardList = reportRewardList;
        setUpdateOption();
    }

    public void setLastResetTime(long lastResetTime) {
        if (this.lastResetTime != lastResetTime) {
            this.lastResetTime = lastResetTime;
            setUpdateOption();
        }
    }

    public long getLastResetTime() {
        return lastResetTime;
    }

    public List<Integer> getReportRewardList() {
        return reportRewardList;
    }

    public int getActivityId() {
        return activityId;
    }

    public long getUserId() {
        return userId;
    }

    public BigDecimal getMoney() {
        return money;
    }

    public Map<Integer, HangHaiGoods> getGoodsMap() {
        return goodsMap;
    }

    public int getPortId() {
        return portId;
    }

    public int getToPortId() {
        return toPortId;
    }

    public long getFinishTime() {
        return finishTime;
    }

    public int getShipLevel() {
        return shipLevel;
    }
}
